package com.atguigu.jxc.controller;/*
 *@author 尹凯瑞
 *@date 2020/12/3 14:25
 */

import com.atguigu.jxc.domain.ServiceVO;
import com.atguigu.jxc.entity.GoodsType;
import com.atguigu.jxc.service.GoodsTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("goodsType")
public class GoodsTypeController {

    @Autowired
    private GoodsTypeService goodsTypeService;

    //查询所有商品的类别 http://localhost:8080/goodsType/loadGoodsType
    @RequestMapping("/loadGoodsType")
    public List<Map> loadGoodsType(){
        return goodsTypeService.loadGoodsType();
    }
    //添加分类 http://localhost:8080/goodsType/save
    @RequestMapping("/save")
    public ServiceVO save(String goodsTypeName,Integer pId){
        return goodsTypeService.saveType(goodsTypeName,pId);
    }
    //删除分类 http://localhost:8080/goodsType/delete
    @RequestMapping("/delete")
    public ServiceVO delete(Integer  goodsTypeId){
        return goodsTypeService.deleteType(goodsTypeId);
    }
}
